;
(function (win, doc) {
    // 默认参数配置
    var defaultSettings = {
        container: "floorToggle",
        containerCss: {
            left: "1rem",
            width: "4rem",
            height: "15rem"
        },
        floorLiCss: {
            width: "100%",
            height: "2.5rem",
            color: "#595959",
            fontSize: "0.27rem",
            backgroundColor: "#f7f7f3",
            marginBottom: ".5rem",
            borderRadius: "2px"
        }
    };
    var FloorToggle = /** @class */ (function () {
        function FloorToggle(options) {
            var self = this;
            if (!options) {
                throw new Error("请传入配置参数");
            }
            self = Object.assign(self, defaultSettings, options);
            self.container = doc.getElementById(self.container);
            self.initFloor();
        }
        FloorToggle.prototype.initFloor = function () {
            var self = this, floorToggleLiHtml = '';
            self.area.forEach(function (element) {
                floorToggleLiHtml = floorToggleLiHtml + ("\n                    <li class=\"floorToggleUl_List\" id=\"floorToggleUl_List\">\n                       <i class=\"floorToggleMinUl_i\"></i>\n                       <div class=\"floorToggleLi\" name=\"btn\" data=" + element.FloorID + " value=\"" + element.Name + "\">" + element.Name + "</div>\n                    </li>\n                    ");
            });
            self.container.innerHTML = floorToggleLiHtml;
            // 设置最外层盒子的css属性
            self.container.style.cssText = "list-style-type: none;\n            position: absolute;\n            left: " + self.containerCss.left + ";\n            top: 50%;\n            transform: translateY(-50%);\n            width: " + self.containerCss.width + ";\n            height: " + self.containerCss.height + ";\n            overflow: auto;";
            // 设置每个li的css属性
            var toggleLi = doc.getElementsByClassName('floorToggleUl_List');
            var _loop_1 = function (i) {
                toggleLi[i].style.cssText = "\n                width: " + self.floorLiCss.width + ";\n                height: " + self.floorLiCss.height + ";\n                text-align: center;\n                font-size: " + self.floorLiCss.fontSize + ";\n                line-height: " + self.floorLiCss.height + ";\n                color: " + self.floorLiCss.color + ";\n                background-color: " + self.floorLiCss.backgroundColor + ";\n                margin-bottom: " + self.floorLiCss.marginBottom + ";\n                border-radius: " + self.floorLiCss.borderRadius + ";\n                ";
                if (toggleLi[i].children[1].innerHTML == '1F' || toggleLi[i].children[1].innerHTML == '1f' || toggleLi[i].children[1].innerHTML == 'f1' || toggleLi[i].children[1].innerHTML == 'F1' || toggleLi[i].children[1].innerHTML == '1L' || toggleLi[i].children[1].innerHTML == '1l' || toggleLi[i].children[1].innerHTML == 'L1' || toggleLi[i].children[1].innerHTML == 'l1') {
                    toggleLi[i].children[1].style.cssText = "border: 1px solid #ac3838;border-radius: 3px;color: #ac3838";
                }
                toggleLi[i].addEventListener('click', function () {
                    if (self.map) {
                        self.map.showFloors([self.area[i].FloorID], true);
                        for (var index = 0; index < toggleLi.length; index++) {
                            var element = toggleLi[index];
                            element.children[1].style.cssText = "border-radius: 3px;color: #595959";
                        }
                        toggleLi[i].children[1].style.cssText = "border: 1px solid #ac3838;border-radius: 3px;color: #ac3838";
                    }
                    else {
                        console.log('你没有传入初始化地图对象');
                    }
                });
            };
            for (var i = 0; i < toggleLi.length; i++) {
                _loop_1(i);
            }
        };
        FloorToggle.prototype.selectFloorColor = function (selectFloors) {
            var matchIndex = 0;
            if (!selectFloors) {
                throw new Error("请传入选中楼层参数");
            }
            var toggleLi = doc.getElementsByClassName('floorToggleUl_List');
            var _loop_2 = function (index) {
                var element = toggleLi[index];
                element.children[1].style.cssText = "border-radius: 3px;color: #595959";
                selectFloors.forEach(function (e) {
                    if (e == element.children[1].getAttribute('data')) {
                        element.children[1].style.cssText = "border: 1px solid #ac3838;border-radius: 3px;color: #ac3838";
                        matchIndex++;
                    }
                });
            };
            for (var index = 0; index < toggleLi.length; index++) {
                _loop_2(index);
            }
            console.log('matchIndex :', matchIndex);
            if (matchIndex != selectFloors.length) {
                throw new Error("传入的楼层中有与地图初始化楼层不匹配项");
            }
        };
        return FloorToggle;
    }());
    window.FloorToggle = FloorToggle;
})(window, document);
